// 定义 vue 组件：  页头元素

Vue.component("my-header",{
    // template 内部元素必须是单根节点
    template : `
    <div>
      <div id="top"> 
   <span><a href="https://www.dygang.org/" target="_blank"> <font color="#3333cc">手机版 </font></a>| <a href="#" onclick="javascript:window.external.AddFavorite('www.dygangs.com', 'http://www.dygangs.com/')" target="_self">加入收藏</a> |<a href="e/tool/gbook/?bid=1" target="_blank">访客留言</a></span> 
   <font color="#000000">请大家使用www.dygangs.com访问电影港,谢谢.</font>| 
   <a href="http://www.dygangs.com/e/search/result/?searchid=176303" target="_blank"> <font color="#3333cc">喜剧片 </font></a>
   <font color="#3333cc"> </font>| 
   <a href="http://www.dygangs.com/e/search/result/?searchid=178216" target="_blank"> <font color="#3333cc">动作片 </font></a>
   <font color="#3333cc"> </font>| 
   <a href="http://www.dygangs.com/e/search/result/?searchid=176518" target="_blank"> <font color="#3333cc">爱情片 </font></a>
   <font color="#3333cc"> </font>| 
   <a href="http://www.dygangs.com/e/search/result/?searchid=178275" target="_blank"> <font color="#3333cc">恐怖片 </font></a>
   <font color="#3333cc"> </font>| 
   <a href="http://www.dygangs.com/e/search/result/?searchid=179239" target="_blank"> <font color="#3333cc">悬疑片 </font></a>
   <font color="#3333cc"> </font>| 
   <a href="http://www.dygangs.com/e/search/result/?searchid=176356" target="_blank"> <font color="#3333cc">科幻片 </font></a>
   <font color="#3333cc"> </font>| 
   <a href="http://www.dygangs.com/e/search/result/?searchid=184707" target="_blank"> <font color="#3333cc">奇幻片 </font></a>
   <font color="#3333cc"> </font>| 
   <a href="http://www.dygangs.com/e/search/result/?searchid=184575" target="_blank"> <font color="#3333cc">传记片 </font></a>
   <font color="#3333cc"> </font>| 
   <a href="http://www.dygangs.com/e/search/result/?searchid=178108" target="_blank"> <font color="#3333cc">战争片 </font></a>
   <font color="#3333cc"> </font>| 
   <a href="http://www.dygangs.com/e/search/result/?searchid=179216" target="_blank"> <font color="#3333cc">剧情片 </font></a>
   <font color="#3333cc"> </font>| 
   <a href="http://www.dygangs.com/e/search/result/?searchid=176296" target="_blank"> <font color="#3333cc">印度电影 </font></a>
   <font color="#3333cc"> </font>|  
  </div> 
      <table cellspacing="0" cellpadding="2" width="980" align="center" border="0"> 
       <tbody> 
        <tr> 
         <td width="207" height="60"> <a href="/C116_S2_Ply_dygang_war/"> <img src="res/images/logo.gif" border="0"> </a> </td> 
         <td width="773" colspan="2"> 
          <div> 
          </div> </td> 
        </tr> 
       </tbody>
      </table>     
      <table height="2" cellspacing="0" cellpadding="2" width="980" align="center" border="0"> 
       <tbody> 
        <tr> 
         <td class="nav-line"></td> 
        </tr> 
       </tbody> 
      </table> 
      <table cellspacing="0" cellpadding="2" width="980" align="center" border="0"> 
       <tbody> 
        <tr> 
         <td class="bg-fleet"> &nbsp;&nbsp;&nbsp; <a href="/">首页</a> |
          <template v-for="c in cates">
           <a :href="'search.html?category=' + c.sn">{{c.name}}</a> |
          </template>
          <a href="/gp/20181022/41407.htm" target="_blank">[本站教程]</a> </td>
        </tr> 
       </tbody> 
      </table> 
      <table width="980" align="center"> 
       <tbody>
        <tr>
         <td></td> 
        </tr>
       </tbody>
      </table> 
   <form action="search.html" method="get" name="searchform" id="searchform"><!--</form> -->
   <table width="978" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#9966FF" class="so" style="border: 1px solid #ccc"> 
   <input type="hidden" name="tempid" value="1">
   <input type="hidden" name="tbname" value="article"> 
   <tbody>
    <tr> 
     <td width="10%" height="28">&nbsp;&nbsp;搜索关键字:</td> 
     <td width="18%" align="left"> <input name="name" type="text" id="keyboard" size="25"> </td> 
     <td width="6%">&nbsp;&nbsp;范 围:</td> 
     <td width="10%"> <select name="show"> <option value="title,smalltext" selected>默认 </option><option value="title">仅搜索标题 </option></select>  </td>
     <td width="5%" align="center" target="_self"> <input class="input-button" type="submit" value="搜索" name="Submit"> </td> 
     <td width="1%"></td> 
     <td width="50%"> 热门搜索： <a href="http://www.dygangs.com/e/search/result/?searchid=176165" target="_blank">行尸走肉</a> &nbsp; <a href="http://www.dygangs.com/e/search/result/?searchid=179847" target="_blank">复仇者联盟</a> &nbsp; <a href="http://www.dygangs.com/e/search/result/?searchid=176810" target="_blank">速度与激情</a> &nbsp; <a href="http://www.dygangs.com/e/search/result/?searchid=179260" target="_blank">权力的游戏</a> &nbsp; <a href="http://www.dygangs.com/e/search/result/?searchid=176475" target="_blank">变形金刚</a> <br> </td> 
    </tr>  
   </tbody>
  </table>
  </form> 
    </div>
    `,
    data(){
        return {
            cates : [], // 分类
        }
    },
    created(){
        axios.get("queryCate.s").then(res=>{
            this.cates = res.data;
        });
    }
})


Vue.component("my-news", {
    template : `
            <table cellspacing="0" cellpadding="2" width="100%" align="center" border="0"> 
         <tbody> 
          <tr> 
           <td valign="top"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
             <tbody>
              <tr v-for=" i in 4">
               <td v-for=" j in 4 " v-if="(i-1) * 4 + (j-1) < news.length" width="25%">
                <table width="136" border="0" cellspacing="2" cellpadding="0">
                 <tbody>
                  <tr>
                   <td width="132">
                    <table class="border1" cellspacing="0" cellpadding="3" border="0">
                     <tbody>
                      <tr>
                       <td> <a :href="'detail.html?id=' + news[(i-1) * 4 + (j-1)].id" target="_blank">
                         <img :src="news[(i-1) * 4 + (j-1)].poster" border="0" width="120" height="150"
                              :alt="news[(i-1) * 4 + (j-1)].name"> </a> </td>
                      </tr>
                     </tbody>
                    </table>
                    <table border="0" align="center" cellpadding="3" cellspacing="0">
                     <tbody>
                      <tr>
                       <td> <a :href="'detail.html?id=' + news[(i-1) * 4 + (j-1)].id" target="_blank" class="c2">
                        {{ news[(i-1) * 4 + (j-1)].name}}
                       </a> </td>
                      </tr>
                     </tbody>
                    </table>
                    <table border="0" align="center" cellpadding="3" cellspacing="0">
                     <tbody>
                      <tr>
                       <td>{{news[(i-1) * 4 + (j-1)].create_date}}</td>
                      </tr>
                     </tbody>
                    </table> </td>
                  </tr>
                 </tbody>
                </table> </td>
              </tr>
             </tbody>
            </table> </td> 
          </tr> 
         </tbody> 
        </table> 
    `,
    props : [ 'category' ],
    data(){
        return {
            news: []
        }
    },
    created(){
        axios.get("queryMovieNews.s?category=" + this.category).then(res=>{
            this.news = res.data;
        })
    }
})